abstract class $NFE{NTP} < $NIL,$STR,$IS_EQ |
---|
**** | Abstract class defined over numeric field elements. Due to contravariance, we need to parametrize over NTP which is the type of the argument to many of the defined routines. Note that this abstraction is not under $IS_LT{T}, since elements such as complex numbers are incomparable
_ The subtyping structure is: ___$NFE{T}__---_$NUMBER{T}_------_$REAL_NUMBER{T}_--_FLT __________________________________________________--_FLTD ___________________________------_INT_ ___________---_$CPX_NUMBER{ETP,T}_---_CPX |
$IS_EQ | $STR | $NIL | $IS_NIL |
$NUMBER{_} | INT | $REAL_NUMBER{_} | FLTD | FLT | $CPX_NUMBER{_,_} | CPX | CPXD | CPX{_} |
abs: NTP; |
---|
**** | Return the absolute value of self |
create(v: INT): SAME; |
---|
**** | Create a number from the floating point value. There might be some loss or gain of precision. |
create(v: FLT): SAME; |
---|
**** | Create a number from the floating point value. There might be some loss or gain of precision. |
create(v: FLTD): SAME; |
---|
**** | Create from a double value in some reasonable way |
div(n: NTP): SAME; |
---|
**** | Return the quotient of self and "n" |
maxval: NTP;; |
---|
**** | Return the maximal allowed value |
minus(n: NTP): SAME; |
---|
**** | Return self - n |
negate: NTP; |
---|
**** | Return the negation of self |
one: NTP; |
---|
**** | Return a unit value |
plus(n: NTP): SAME; |
---|
**** | Return self+n |
times(n: NTP): SAME; |
---|
**** | Return self * n |
zero: NTP; |
---|
**** | Return the zero value |